package top.wuliaodebaozi2.yunpan;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class HomeFragment extends Fragment {

    private HomeFragment(){}
    private static HomeFragment homeFragment = new HomeFragment();

    public static Fragment newInstance(){
        return homeFragment;
    }

    @SuppressLint("SetJavaScriptEnabled")
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        View view = inflater.inflate(R.layout.fragment_home, null);
        view.findViewById(R.id.bt_wss).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Uri uri = Uri.parse("https://www.wenshushu.cn/");
                startActivity(new Intent(Intent.ACTION_VIEW,uri));
            }
        });
        view.findViewById(R.id.bt_air_portal).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Uri uri = Uri.parse("https://airportal.cn/");
                startActivity(new Intent(Intent.ACTION_VIEW,uri));
            }
        });
        view.findViewById(R.id.bt_sa).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Uri uri = Uri.parse("https://airportal.cn/");
                startActivity(new Intent(Intent.ACTION_VIEW,uri));
            }
        });
        view.findViewById(R.id.bt_tp).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Uri uri = Uri.parse("https://www.tmp.link/");
                startActivity(new Intent(Intent.ACTION_VIEW,uri));
            }
        });

        view.findViewById(R.id.bt_tp).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Uri uri = Uri.parse("https://send-anywhere.com");
                startActivity(new Intent(Intent.ACTION_VIEW,uri));
            }
        });
        view.findViewById(R.id.bt_wormhole).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Uri uri = Uri.parse("https://wormhole.app/");
                startActivity(new Intent(Intent.ACTION_VIEW,uri));
            }
        });
        return view;
    }

    @Override
    public void onAttach(@NonNull Context context) {
        super.onAttach(context);
    }
}
